package com.aisile.manager.controller;


import com.aisile.entity.PageResult;
import com.aisile.entity.Result;
import com.aisile.pojo.TbSeller;
import com.aisile.sellergoods.service.SellerService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("seller")
public class SellerController {

    @Reference
    SellerService sellerService;

    @RequestMapping("findPage")
    public PageResult findPage(int page, int rows, @RequestBody TbSeller tbSeller){

      return   sellerService.findPage(page, rows, tbSeller);


    }

    @RequestMapping("findOne")
    public TbSeller findOne(String sellerId){

        return sellerService.findById(sellerId);
    }

    @RequestMapping("updateStatus")
    public Result updateStatus(String sellerId,String status){

        try{
            sellerService.updateStatus(sellerId,status);
            return new Result(true,"成功");
        }
        catch (Exception e){

            return new Result(false,"服务器出现异常");

            }

    }
}
